www.gusucode.com > VC++ 实现Flash动画全屏播放-源码程序 > VC++ 实现Flash动画全屏播放-源码程序/code/FlashStart/FlashDlg.cpp

    //Download by http://www.NewXing.com
// FlashDlg.cpp : implementation file
//

#include "stdafx.h"
#include "FlashStart.h"
#include "FlashDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CFlashDlg dialog


CFlashDlg::CFlashDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CFlashDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CFlashDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CFlashDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CFlashDlg)
//	DDX_Control(pDX, IDC_SHOCKWAVEFLASH1, m_flashCtrl);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CFlashDlg, CDialog)
	//{{AFX_MSG_MAP(CFlashDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CFlashDlg message handlers

BOOL CFlashDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	int CX=::GetSystemMetrics(SM_CXSCREEN);
	int CY=::GetSystemMetrics(SM_CYSCREEN);
	CRect rect(0,0,CX,CY);
//	ClientToScreen(&rect);
	::MoveWindow(GetSafeHwnd(),0,0,CX,CY,TRUE);
//	m_flashCtrl.ClientToScreen(&rect);
//	CRect rect;
	GetClientRect(&rect);
	m_flashCtrl.Create("ShockwaveFlash",WS_POPUP|WS_VISIBLE,rect,this,ID_FLASHWIN,NULL,FALSE,NULL);
	// 获取应用程序所在路径
	char szCurPath[_MAX_PATH];
	HINSTANCE hInst=NULL;
	GetModuleFileName(hInst,szCurPath,_MAX_PATH);
	char* p = szCurPath;
	while(strchr(p,'\\'))
	{
		p = strchr(p,'\\');
		p++;
	}
	*p = '\0';
	CString strFilename = szCurPath;	// 生成播放文件名
	strFilename += "1.swf";
	m_flashCtrl.SetMovie(strFilename);

//	m_flashCtrl.Zoom(0);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}